﻿using System.Windows;
using System.Windows.Controls;
using Gao.Poker.App.ViewModel;
using Gao.Poker.Domain;

namespace Gao.Poker.App.Store
{
    /// <summary>
    /// Interaction logic for InventoryView.xaml
    /// </summary>
    public partial class InventoryView : UserControl
    {
         public ProductViewModel ViewModel { get; set; }

         public InventoryView()
        {
            InitializeComponent();

            ViewModel = new ProductViewModel();
            ViewModel.Message = OnMessage;
            DataContext = ViewModel;

            btnSearch.Click += Search_Click;
        }

        private void Search_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.OnPropertyChanged("Products");
        }

        private void OnMessage(string obj)
        {
            MessageBox.Show(obj, "提示消息", MessageBoxButton.OK, MessageBoxImage.Warning);
        }

        public void addNewStone()
        {
            ViewModel.Product = new Product();
        }
    }
}
